<?php 
session_start();
include("include/config.php");
$url = $_SERVER['HTTP_REFERER'];
?>

<script type="text/javascript">
function ManageSubmit(){

   var chk_val=document.getElementById('chk_val').value;
   var url=document.getElementById('url').value;
   
   alert(chk_val);alert(url);
   
   if(document.getElementById('chk_val').value=='')
   {
    	$('#chk_val').css('border','1px solid #FF0000');
		return false;
   }
   else 
   		$('#chk_val').css('border','1px solid #ccc');
	
	var params ={

		'module': 'validate',
		'chk_val': chk_val
	};

   if(chk_val!='')
   {
	  $.ajax({
		type: "POST",
		url: 'validate_check.php',
		data: params,
		dataType : 'json',
		success: function(data){
		if (data.flag == '1')
		  {
			window.location.href=url;
		  }
		else
		  {
			/*$('#msgbox').fadeIn(0);
		    $('#msgbox').html('Review post successfully.');
		    $('#msgbox').fadeOut(5000);*/
		  }
        }
      });
	}
  
}
</script>
<?
/*if(isset($_REQUEST['sub_val'])){

	//$url = $_REQUEST['url'];
	if(in_array($_REQUEST['chk_val'],$validate_array)){
		$_SESSION['VALIDATE_ACTIVE']=1; 
		header("location:".SITE_URL);
	}

}*/

?>

<form name="frm_validate" id="frm_validate" action="" method="post">
<input type="hidden" name="url" id="url" value="<?php echo $url?>" />
<input type="text" name="chk_val" id="chk_val" /><br />
<input type="button" name="sub_val" id="sub_val" value="Check Validation" onclick="ManageSubmit();" />
</form>

